<template>
  <div>
    <el-carousel trigger="click" height="360px" class="pics">
      <el-carousel-item>
        <img class="pic" src="@/assets/pic1.jpg" title="标题1">
      </el-carousel-item>
      <el-carousel-item>
        <img class="pic" src="@/assets/pic2.jpg" title="标题2">
      </el-carousel-item>
      <el-carousel-item>
        <img class="pic" src="@/assets/pic3.jpg" title="标题3">
      </el-carousel-item>
      <el-carousel-item>
        <img class="pic" src="@/assets/pic4.jpg" title="标题4">
      </el-carousel-item>
      <el-carousel-item>
        <img class="pic" src="@/assets/pic5.jpg" title="标题5">
      </el-carousel-item>
    </el-carousel>
    <el-table :data="list" style="width: 100%;padding-top: 15px;">
      <el-table-column label="分类" width="100" align="center">
        <template slot-scope="scope">
          {{ scope.row.type }}
        </template>
      </el-table-column>
      <el-table-column label="标题" min-width="100">
        <template slot-scope="scope">
          {{ scope.row.title }}
        </template>
      </el-table-column>
      <el-table-column label="发文单位" width="100" align="center">
        <template slot-scope="scope">
          {{ scope.row.unitName }}
        </template>
      </el-table-column>
      <el-table-column label="日期" width="100" align="center">
        <template slot-scope="scope">
          {{ scope.row.date }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { transactionList } from '@/api/remote-search'

export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        success: 'success',
        pending: 'danger'
      }
      return statusMap[status]
    },
    orderNoFilter(str) {
      return str.substring(0, 30)
    }
  },
  data() {
    return {
      list: [
        { type: '通知公告', unitName: '处非办', title: '通知公告通知公告通知公告通知公告', date: '2021-06-01' },
        { type: '政策法规', unitName: '处非办', title: '政策法规政策法规政策法规政策法规政策法规1', date: '2021-05-31' },
        { type: '政策法规', unitName: '公安局', title: '政策法规政策法规政策法规政策法规2', date: '2021-05-25' },
        { type: '政策法规', unitName: '法院', title: '政策法规政策法规政策法规政策法规3', date: '2021-05-20' },
        { type: '政策法规', unitName: '法院', title: '政策法规政策法规政策法规政策法规4', date: '2021-05-20' }
      ]
    }
  },
  created() {
    // this.fetchData()
  },
  methods: {
    fetchData() {
      transactionList().then(response => {
        this.list = response.data.items.slice(0, 8)
      })
    }
  }
}
</script>

<style scoped>
.readed {
  color:#ccc
}
.notread{
  color:#E69900
}
.pics{
  width: 100%;
  height: 360px;
  background: #fff;
}
.pic{
  width: 100%;
  height: 360px;
}
</style>
